package com.gadgetscode.mazeboy;

import java.awt.event.KeyEvent;

public class Boy extends Sprite implements GameAssets {
	
	public static boolean boyRightLeft = false;
	public static boolean boyLeftRight = false;
	public static boolean boyUpLeft = false;
	public static boolean boyDownRight = false;

	public void keyPressed(KeyEvent e) {
		int key = e.getKeyCode();

		if (key == KeyEvent.VK_LEFT)
		{
			dx = -2;
			setDirection(LEFT);
		}

		if (key == KeyEvent.VK_RIGHT)
		{
			dx = 2;
			setDirection(RIGHT);
		}
		
		if(key == KeyEvent.VK_UP) {
			dy = -2;
			setDirection(UP);
		}
		
		if(key == KeyEvent.VK_DOWN) {
			dy = 2;
			setDirection(DOWN);
		}
	}

	public void keyReleased(KeyEvent e) {
		int key = e.getKeyCode();

		if (key == KeyEvent.VK_LEFT)
		{
			dx = 0;
		}

		if (key == KeyEvent.VK_RIGHT)
		{
			dx = 0;
		}
		
		if(key == KeyEvent.VK_UP) {
			dy = 0;
		}
		
		if(key == KeyEvent.VK_DOWN) {
			dy = 0;
		}
	}

}
